<template>
    <view>
        <view class="message">
            <view class="list" v-for="(item,key) in list" :key="key">
                <navigator  :url="'../pinglun/index?id='+item.id" open-type="navigate" >
                    <view class="list_left">
                        <view class="heade">
<!--                            <image src="/static/img/duihua.png" class="img"></image>-->
                            <text class="iconfont color_40" v-if="item.image==='xe627'">&#xe627;</text>
                            <text class="iconfont color_40" v-if="item.image==='xe623'">&#xe623;</text>
                            <text class="iconfont color_40" v-if="item.image==='xe628'">&#xe628;</text>
                            <text class="iconfont color_40" v-if="item.image==='xe62b'">&#xe62b;</text>
                        </view>
                        <view class="content" >
                            <view class="title">
                                <view class="font-regular">{{item.name}}</view>
                                <view class="date font-light" v-if="item.message">{{strToTime(item.message)}}</view>
                            </view>
                            <view class="des font-light" v-if="item.message">{{item.message.content}}</view>
                            <view class="des font-light" v-else>暂时没有新的{{item.name}}</view>

                            <view class="des" v-else style="color:white">_</view>

                            <view class="num font-semibold" v-if="item.message">{{item.message_count}}</view>
                        </view>
                    </view>
                </navigator>
            </view>




        </view>
    </view>
</template>

<script>
  import Request from '@/utils/request.js'
  import tool from '@/utils/tool.js'

  export default {
    name: "index",
    data() {
      return {
        list: 0,
        page: 0
      }
    },
    created: function () {

    },
    onShow(){
      this.getList();
    },
    methods: {
      strToTime(time){
        if(!time)
          return '';
        return tool.timeToString(time.created_at);
      },
      getList(){
        Request.get('/notice/massage_type').then((res)=>{
          this.list=res.data;
        })
      }
    }
  }
</script>

<style lang='scss'>
    .message{
        padding: 0upx 55upx;
        .list{
            display: flex;
            align-items: center;
            justify-content: space-between;
            .list_left{
                display: flex;
                align-items: center;
                .heade{
                    width: 90upx;
                    height: 90upx;
                    border-radius: 50%;
                    background-color: $uni-color-fffbf0;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    .color_40{
                        color: $uni-color-fcb300;
                        font-size: 40upx;
                    }
                }
                .content{
                    width: 528upx;
                    margin-left: 20upx;
                    padding:40upx 0;
                    box-sizing: border-box;
                    border-bottom: 2upx solid $uni-border-color;
                    position: relative;
                    .title{
                        display: flex;
                        justify-content: space-between;
                        align-items: center;
                        font-size: $uni-font-size-base;
                        color: $uni-color-664e37;
                        .date{
                            font-size: $uni-font-size-sm;
                        }
                    }
                    .des{
                        width: 100%;
                        overflow: hidden;
                        text-overflow:ellipsis;
                        white-space: nowrap;
                        padding-top: 8upx;
                        font-size: $uni-font-size-13;
                        color: $uni-color-876a48;
                    }
                    .num{
                        position: absolute;
                        bottom: 40upx;
                        right:0upx;
                        width: 28upx;
                        height: 28upx;
                        background-color: $uni-color-ff0000;
                        border-radius: 50%;
                        font-size: 18upx;
                        color: #fff;
                        text-align: center;
                        line-height: 28upx;
                    }
                }
            }
        }
    }

</style>
